Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@tokey/imports-parser
Advanced tools
Parser for esm
like import syntax with support for "functional" tagged imports
import Name1, { Name2, Name3 as Name4, Tag(Name5) } from "request";
The output of parsing an import is represented with the following type:
interface ImportValue {
star: boolean;
defaultName: string | undefined;
named: Record<string, string> | undefined;
tagged: Record<string, Record<string, string>> | undefined;
from: string | undefined;
errors: string[];
start: number;
end: number;
}
Notice that this parser can parse broken/incomplete syntax and all the errors will be available in the "error" field.
The parser parses multiple imports and the result is an
ImportValue[]
import { parseImports, ImportValue } from "@tokey/imports-parser";
const code = `
import { a } from "request/a";
import "request/b";
`;
const startNamedBlock = '{'; // default
const endNamedBlock = '}'; // default
const shouldParseTags = false // default
const results: ImportValue[] = parseImports(code, startNamedBlock, endNamedBlock, shouldParseTags);
const firstImport = results[0];
firstImport.from === 'request/a'; // true
firstImport.named['a'] === 'a'; // true
FAQs
parser for esm like imports
The npm package @tokey/imports-parser receives a total of 1,783 weekly downloads. As such, @tokey/imports-parser popularity was classified as popular.
We found that @tokey/imports-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.